package com.umakr.ax.security.core;

import com.alibaba.fastjson.JSON;
import com.google.common.collect.ImmutableMap;

import java.util.Map;

/**
 * @author gx
 * @since 2017/5/22
 */
public class SecurityStatusException {

    private SecurityStatusException() {
        throw new IllegalStateException("SecurityStatusException class");
    }

    static Map<String,Object> result(int status,String msg){
        return ImmutableMap.of("result",status,"errorDescription",msg);
    }

    /**
     * @return token过期
     */
    public static String tokenExpired(){
        return JSON.toJSONString(result(-10007,"Access token is expired."));
    }

    /**
     * @return 无权访问资源
     */
    public static String accessDeny(){
        return JSON.toJSONString(result(-10005,"AccessDenied."));
    }
}
